package com.fr.cell;

import com.fr.base.core.GraphHelper;
import com.fr.cell.core.GridColumnMouseHandler;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FontMetrics;
import javax.swing.ActionMap;
import javax.swing.InputMap;

public class GridColumn extends BaseGridComponent
{
  public static final int COLUMN_HEIGHT_AJUST = 4;
  private Color separatorLineColor = new Color(172, 168, 153);
  private Color selectedForeground = Color.black;
  private Color selectedBackground = new Color(253, 216, 153);
  private GridCRRenderer gridCRRender;

  public GridColumn()
  {
    GridColumnMouseHandler localGridColumnMouseHandler = new GridColumnMouseHandler(this);
    addMouseListener(localGridColumnMouseHandler);
    addMouseMotionListener(localGridColumnMouseHandler);
    this.gridCRRender = new DefaultGridColumnRenderer();
    getInputMap().clear();
    getActionMap().clear();
    setFocusable(false);
    setOpaque(true);
    setUI(new GridColumnUI());
  }

  public GridCRRenderer getGridCRRender()
  {
    return this.gridCRRender;
  }

  public void setGridCRRender(GridCRRenderer paramGridCRRenderer)
  {
    this.gridCRRender = paramGridCRRenderer;
  }

  public Color getBackground()
  {
    return super.getBackground();
  }

  public void setBackground(Color paramColor)
  {
    super.setBackground(paramColor);
  }

  public Color getForeground()
  {
    return super.getForeground();
  }

  public void setForeground(Color paramColor)
  {
    super.setForeground(paramColor);
  }

  public Color getSeparatorLineColor()
  {
    return this.separatorLineColor;
  }

  public void setSeparatorLineColor(Color paramColor)
  {
    Color localColor = this.separatorLineColor;
    this.separatorLineColor = paramColor;
    firePropertyChange("separatorLineColor", localColor, this.separatorLineColor);
    repaint();
  }

  public Color getSelectedForeground()
  {
    return this.selectedForeground;
  }

  public void setSelectedForeground(Color paramColor)
  {
    Color localColor = this.selectedForeground;
    this.selectedForeground = paramColor;
    firePropertyChange("selectedForeground", localColor, this.selectedForeground);
    repaint();
  }

  public Color getSelectedBackground()
  {
    return this.selectedBackground;
  }

  public void setSelectedBackground(Color paramColor)
  {
    Color localColor = this.selectedBackground;
    this.selectedBackground = paramColor;
    firePropertyChange("selectedBackground", localColor, this.selectedBackground);
    repaint();
  }

  public Dimension getPreferredSize()
  {
    ReportPane localReportPane = getReportPane();
    if (!(localReportPane.isColumnHeaderVisible()))
      return new Dimension(0, 0);
    return new Dimension(super.getPreferredSize().width, GraphHelper.getFontMetrics(getFont()).getHeight() + 4);
  }
}